home *** CD-ROM | disk | FTP | other *** search
- <?xml version="1.0" encoding="utf-8"?>
- <!-- ===========================================================
- Category: HTML
- Sub-category: RadioButtons
- Author: David Silverlight
- HeadGeek@xmlpitstop.com
- Created: 2001-05-16
- Description:-
- This stylsheet demonstrates how to create radio buttons from
- an xml document. Also note that we are using the Pull
- method to extract data from our xml document. The pull
- method is an approach where the use of templates is
- minimized and data is accessed by 'pulling' it from our xml
- document
- ================================================================ -->
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:output method="html" />
-
- <xsl:template match="/">
- <html>
- <head>
- <style type="text/css">
- H1 {COLOR: red; FONT-FAMILY: Arial; FONT-SIZE: 14pt;}
- H2 {COLOR: darkblue; FONT-FAMILY: Arial; FONT-SIZE: 12pt;}
- .head {COLOR: darkblue; FONT-FAMILY: Arial; FONT-SIZE: 14pt;}
- .subhead {COLOR: darkblue; FONT-FAMILY: Arial; FONT-SIZE: 12pt;}
- .text {COLOR: black; FONT-FAMILY: Arial; FONT-SIZE: 12pt;}
- TH {COLOR: white; FONT-FAMILY: Arial; background-color: darkblue;}
- TD {COLOR: darkblue; FONT-FAMILY: Arial}
- TR { background-color: beige; }
- BODY { background-color: beige; }
- </style>
- </head>
- <body>
- <h1>Generating Radio Buttons from XML Data (Pull Method)</h1>
-
- <xsl:for-each select="UserOptions/option">
- <xsl:value-of select="@title" />
-
- <input type="radio">
- <xsl:attribute name="Name">
- <xsl:value-of select="@groupname" />
- </xsl:attribute>
-
- <xsl:attribute name="ID">
- <xsl:value-of select="@groupname" />
- </xsl:attribute>
-
- <xsl:if test="@default = 'true'">
- <xsl:attribute name="checked" />
- </xsl:if>
- </input>
- </xsl:for-each>
- </body>
- </html>
- </xsl:template>
- </xsl:stylesheet>